﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:SampleData="clr-namespace:Expression.Blend.SampleData.SampleDataSource" xmlns:local="clr-namespace:ProbabilityNot" xmlns:visualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" x:Class="ProbabilityNot.MainPage"
    d:DesignHeight="300" d:DesignWidth="400">

	<UserControl.Resources>
		<local:FloatingPointTextConversion x:Key="FloatingPointTextConversion"/>
		<SampleData:SampleDataSource x:Key="SampleDataSource" d:IsDataSource="True"/>
		<Style x:Key="EmptyLegend" TargetType="visualizationToolkit:Legend">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="visualizationToolkit:Legend">
						<Grid/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White" d:DataContext="{Binding Source={StaticResource SampleDataSource}}">

    	<Grid.RowDefinitions>
    		<RowDefinition/>
    		<RowDefinition Height="51.627"/>
    	</Grid.RowDefinitions>

    	<chartingToolkit:Chart Margin="8,8,8,0" Title="Probability" LegendStyle="{StaticResource EmptyLegend}">
    		<chartingToolkit:AreaSeries DependentValuePath="Y" IndependentValuePath="X" ItemsSource="{Binding CutPointsGaussian, Mode=OneWay}"/>
    		<chartingToolkit:LineSeries DependentValuePath="Y" IndependentValuePath="X" ItemsSource="{Binding DataPointsGaussian, Mode=OneWay}"/>
    		<chartingToolkit:LineSeries DependentValuePath="Y" IndependentValuePath="X" ItemsSource="{Binding DataPointsPoisson, Mode=OneWay}"/>
    		<chartingToolkit:AreaSeries DependentValuePath="Y" IndependentValuePath="X" ItemsSource="{Binding CutPointsPoisson, Mode=OneWay}"/>
    	</chartingToolkit:Chart>
    	<StackPanel HorizontalAlignment="Left" Margin="191,0,0,0" VerticalAlignment="Top" Grid.Row="1">
    		<StackPanel HorizontalAlignment="Right" Margin="0" Orientation="Horizontal" d:LayoutOverrides="Width">
    			<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Probability(%):" TextWrapping="Wrap"/>
    			<TextBox Text="{Binding ProbabilityPercent, Converter={StaticResource FloatingPointTextConversion}, ConverterParameter=0.00, Mode=TwoWay, UpdateSourceTrigger=Default}" TextWrapping="Wrap" Width="80" HorizontalAlignment="Left" VerticalAlignment="Center" TabIndex="1">
    				<i:Interaction.Behaviors>
    					<local:SelectTextOnEntry/>
    				</i:Interaction.Behaviors>
    			</TextBox>

    			<Slider Width="60" Maximum="100" Value="{Binding ProbabilityPercent, Mode=TwoWay, UpdateSourceTrigger=Default}"/>
    		</StackPanel>
    		<StackPanel Margin="0" Orientation="Horizontal">
    			<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Text="# Events(P):" TextWrapping="Wrap"/>
    			<TextBox Text="{Binding NumberEventsPoisson, Converter={StaticResource FloatingPointTextConversion}, ConverterParameter=0.00, Mode=TwoWay, UpdateSourceTrigger=Default}" TextWrapping="Wrap" Width="80" HorizontalAlignment="Right" VerticalAlignment="Center" TabIndex="3">
    				<i:Interaction.Behaviors>
    					<local:SelectTextOnEntry/>
    				</i:Interaction.Behaviors>
    			</TextBox>

    		</StackPanel>
    	</StackPanel>
    	<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1">
    		<StackPanel VerticalAlignment="Top" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0" d:LayoutOverrides="Width">
    			<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Background:" TextWrapping="Wrap"/>
    			<TextBox Text="{Binding BackgroundMean, Mode=TwoWay}" TextWrapping="Wrap" Width="80" HorizontalAlignment="Left" VerticalAlignment="Center" TabIndex="2">
    				<i:Interaction.Behaviors>
    					<local:SelectTextOnEntry/>
    				</i:Interaction.Behaviors>
    			</TextBox>

    		</StackPanel>
    		<StackPanel VerticalAlignment="Top" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0" d:LayoutOverrides="Width">
    			<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Text="Background Width:" TextWrapping="Wrap"/>
    			<TextBox Text="{Binding BackgroundWidth, Mode=TwoWay}" TextWrapping="Wrap" Width="80" HorizontalAlignment="Right" VerticalAlignment="Center" TabIndex="3">
    				<i:Interaction.Behaviors>
    					<local:SelectTextOnEntry/>
    				</i:Interaction.Behaviors>
    			</TextBox>

    		</StackPanel>
    	</StackPanel>
    	<StackPanel HorizontalAlignment="Right" Margin="0" VerticalAlignment="Bottom" Grid.Row="1" Orientation="Horizontal">
    		<Button x:Name="CheckForUpdatesButton" VerticalAlignment="Bottom" RenderTransformOrigin="0.902,0.778" BorderThickness="0" FontSize="5.333" Content="Check For Updates" Click="CheckForUpdates" ToolTipService.ToolTip="Check back with the server to see if an update to Probabity Not is availible." HorizontalAlignment="Left"/>
    		<HyperlinkButton Content="?" NavigateUri="http://probabilitynot.codeplex.com/documentation" TargetName="_newWindow" Foreground="Black"/>
    	</StackPanel>

    </Grid>
</UserControl>
